Dividing propagules by PFT and other issues#822
Merged
davidorme merged 6 commits into750-new-branch-fruit-productionfrom Apr 8, 2025
Merged
Dividing propagules by PFT and other issues#822davidorme merged 6 commits into750-new-branch-fruit-productionfrom
davidorme merged 6 commits into750-new-branch-fruit-productionfrom
Conversation
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
virtual_ecosystem/models/plants/plants_model.py:735
- Duplicate addition detected for canopy_n_propagules in the cohort loop. It appears that the same value is added twice, which may result in double counting; consider removing one of the duplicate updates.
self.data["canopy_n_propagules"].loc[cell_id, cohort_pft] += ( stem_n_propagules * cohort_n_stems )
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 750-new-branch-fruit-production #822 +/- ##
===================================================================
+ Coverage 94.10% 94.11% +0.01%
===================================================================
Files 74 74
Lines 5246 5255 +9
===================================================================
+ Hits 4937 4946 +9
Misses 309 309 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
sallymatson
reviewed
Apr 8, 2025
| # sophisticated approach. | ||
| self.data["leaf_turnover"][cell_id] = np.sum( | ||
| cohort_allocation.foliage_turnover / self.model_timing.updates_per_year | ||
| stem_allocation.foliage_turnover * cohorts.n_individuals |
Collaborator
There was a problem hiding this comment.
Does this mean that turnover values are per stem? I never realized that.
Collaborator
Author
There was a problem hiding this comment.
Yup - the allocation model the GPP for a representative stem in the cohort and gives the resulting stem allocation.
sallymatson
reviewed
Apr 8, 2025
sallymatson
reviewed
Apr 8, 2025
Collaborator
sallymatson
left a comment
There was a problem hiding this comment.
One optimisation question. Otherwise LGTM
sallymatson
approved these changes
Apr 8, 2025
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
These are some changes I think we'll need in the fruit production.
I've tried to tackle the issue of getting fallen propagules per PFT and per cell. That involves a loop over cohorts per cell.
I've applied the same solution to split up the propagules and non propagule mass in the canopy by PFT. Ultimately, I think we need to rethink this bit - at the moment, reproductive mass is kinda plastic until it hits the floor and I think we might need to allocate reproductive tissue to the two classes at a cohort level.
I spotted a problem with the recalculation of the turnover rates - we were calculating the actual allocation using the annual rate and then only passing a timestep fraction of the productivity into the turnover pools. That meant that - for example with monthly timesteps - each month allocated a years worth of turnover but 1/12 was added to the leaf turnover and the remaining 11/12 of the leaf turnover disappeared. I've hacked the rates when the Flora is added to the model, which isn't elegant but I think will do for now.
There was also an issue that per stem allocations weren't being scaled up to the number of individuals in a cohort.
Contributes to fixing #750
Type of change
Key checklist
pre-commitchecks:$ pre-commit run -a$ poetry run pytestFurther checks